.TH "FrovedisSparseData" "" "" "" ""
.SH NAME
.PP
FrovedisSparseData \- A data structure used in modeling the in\-memory
sparse data of frovedis server side at client spark side.
.SH SYNOPSIS
.PP
import com.nec.frovedis.exrpc.FrovedisSparseData
.SS Constructors
.PP
FrovedisSparseData (\f[C]RDD[Vector]\f[] data)
.SS Public Member Functions
.PP
Unit load (\f[C]RDD[Vector]\f[] data)
.PD 0
.P
.PD
Unit loadcoo (\f[C]RDD[Rating]\f[] data)
.PD 0
.P
.PD
Unit debug_print()
.PD 0
.P
.PD
Unit release()
.SH DESCRIPTION
.PP
FrovedisSparseData is a pseudo sparse structure at client spark side
which aims to model the frovedis server side sparse data (basically crs
matrix).
.PP
Note that the actual sparse data is created at frovedis server side
only.
Spark side FrovedisSparseData contains a proxy handle of the in\-memory
sparse data created at frovedis server, along with number of rows and
number of columns information.
.SS Constructor Documentation
.SS FrovedisSparseData (\f[C]RDD[Vector]\f[] data)
.PP
It accepts a spark\-side RDD data of sparse or dense Vector and converts
it into the frovedis server side sparse data whose proxy along with
number of rows and number of columns information are stored in the
constructed FrovedisSparseData object.
.PP
For example,
.IP
.nf
\f[C]
//\ sample\ input\ matrix\ file\ with\ elements\ in\ a\ row\ separated\ by\ whitespace
val\ data\ =\ sc.textFile(input)
//\ parsedData:\ RDD[Vector]
val\ parsedData\ =\ data.map(s\ =>\ Vectors.dense(s.split(\[aq]\ \[aq]).map(_.toDouble)))
//\ conversion\ of\ spark\ data\ to\ frovedis\ side\ sparse\ data
val\ fdata\ =\ new\ FrovedisSparseData(parsedData)
\f[]
.fi
.SS Pubic Member Function Documentation
.SS Unit load (\f[C]RDD[Vector]\f[] data)
.PP
This function can be used to load a spark side sparse data to a frovedis
server side sparse data (crs matrix).
It accepts a spark\-side RDD data of sparse or dense Vector and converts
it into the frovedis server side sparse data whose proxy along with
number of rows and number of columns information are stored in the
target FrovedisSparseData object.
.PP
For example,
.IP
.nf
\f[C]
//\ sample\ input\ matrix\ file\ with\ elements\ in\ a\ row\ separated\ by\ whitespace
val\ data\ =\ sc.textFile(input)
//\ parsedData:\ RDD[Vector]
val\ parsedData\ =\ data.map(s\ =>\ Vectors.dense(s.split(\[aq]\ \[aq]).map(_.toDouble)))

val\ fdata\ =\ new\ FrovedisSparseData()\ //\ an\ empty\ object
//\ conversion\ of\ spark\ data\ to\ frovedis\ side\ sparse\ data
fdata.load(parsedData)
\f[]
.fi
.SS Unit loadcoo (\f[C]RDD[Rating]\f[] data)
.PP
This function can be used to load a spark side Rating matrix (COO data)
to a frovedis server side sparse data (crs matrix).
It accepts a spark\-side \f[C]RDD[Rating]\f[] object and converts it
into the frovedis server side sparse data whose proxy along with number
of rows and number of columns information are stored in the target
FrovedisSparseData object.
.PP
For example,
.IP
.nf
\f[C]
//\ sample\ input\ matrix\ file\ with\ rows\ of\ COO\ triplets\ (i,j,k)
val\ data\ =\ sc.textFile(input)
//\ ratings:\ RDD[Rating]
val\ ratings\ =\ data.map(_.split(\[aq],\[aq])\ match\ {\ case\ Array(user,\ item,\ rate)\ =>
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Rating(user.toInt,\ item.toInt,\ rate.toDouble)
\ \ \ \ \ \ \ \ \ \ \ \ \ \ })

val\ fdata\ =\ new\ FrovedisSparseData()\ //\ an\ empty\ object
//\ conversion\ of\ spark\ coo\ data\ to\ frovedis\ side\ sparse\ (crs)\ data
fdata.loadcoo(ratings)\ 
\f[]
.fi
.SS Unit debug_print()
.PP
It prints the contents of the server side sparse data on the server side
user terminal.
It is mainly useful for debugging purpose.
.SS Unit release()
.PP
This function can be used to release the existing in\-memory data at
frovedis server side.
